#include "player.h"
#include "display.h"

extern int com;
extern MUSIC m_List[4];
PLAYER player(m_List);

#define BLEcom    1    //预处理BLEcom是1,就包含蓝牙模块,方便移植为串口或者无线网(NRF24)发送命令
#define NRFcom    0    //
#define USARTcom    0  //不可同时预处理,否则报错
/*可以封装com抽象类然后由此派生,使代码更优雅简洁
这里为了运行效率,采取了预处理的方案*/
#if BLEcom
#include "BLE.h"
#endif
void setup() {

#if BLEcom
  BLE_Init();
#endif
  
  Wire.begin();
  display_init();

}
void loop()
{
  ComAnalysis();
  if (com != -1)
  {
    if (com == 1)
    {
      player.IsPlay = !player.IsPlay;
    }
    else if (com == 3)
    {
      player.changeMode();
    }
  }
  if (player.IsPlay == true)
    player.play();
}

